#!/bin/bash

# description:初始化系统环境

slaveHosts=("dev5" "dev6")

# 编辑/etc/ssh/ssh_config文件，不询问，内容如下
# StrictHostKeyChecking no

# 编辑/etc/hosts：集群中所有主机名与ip的映射


for salve in ${slaveHosts[*]}
do
	
	echo "copy ssh config file to $salve"
	rsync -a -v -z -e ssh --delete /etc/ssh/ssh_config $salve:/etc/ssh/
	ssh root@$salve "service sshd restart && exit 0"

	echo "copy hosts file to $salve"
	rsync -a -v -z -e ssh --delete /etc/hosts $salve:/etc/
	rsync -a -v -z -e ssh --delete /etc/profile $salve:/etc/
	rsync -a -v -z -e ssh --delete ./_hadoop_config_post.sh $salve:/root/
	ssh root@$salve "source /etc/profile && exit 0"
done

echo "copy system config file end"
